<route lang="json5" type="page">
{
  layout: 'default',
  style: {
    navigationBarTitleText: '确认订单',
  },
}
</route>

<template>
  <view>
    <view class="mt-2"></view>
    <!-- 地址信息 -->
    <address-card :address="addressStore.defaultAddress" @click="handleClick" />

    <!-- 商品详情 -->
    <order-card />

    <!-- 提交按钮 -->
    <view class="fixed bottom-0 left-0 right-0 flex justify-between items-center m-2">
      <text class="text-red-6 font-500 text-xl">¥ 6399</text>
      <wd-button class="m-0" @click="submitOrder">提交订单</wd-button>
    </view>

    <address-action-sheet v-model="show" />
  </view>
</template>

<script lang="ts" setup>
import AddressCard from '@/components/address-card.vue'
import OrderCard from '@/components/order-card.vue'
import AddressActionSheet from '@/components/address-action-sheet.vue'
import { useAddressStore } from '@/store'

const addressStore = useAddressStore()

const show = ref(false)
const handleClick = () => {
  console.log('handleClick')

  show.value = true
}

const submitOrder = () => {
  uni.showToast({
    title: '订单提交',
    icon: 'success',
  })
  uni.navigateTo({
    url: '/pages/order-pay/order-pay',
  })
}
</script>

<style lang="scss" scoped></style>
